<template>
  <div class="aiDrawingHistory_container">
    <van-nav-bar
			:title="$t('AI绘图历史')"
			left-arrow
			@click-left="onClickLeft"
		>
		</van-nav-bar>
		<div class="aiDrawingHistory_container_box padding-1">
			<div class="aiDrawingHistory_container_box_card padding-1 br-16 mb-1" v-for="(item,index) in aiDrawList" :key="index" @click="goImageDetail(item)">
				<div class="card_time mb-0">{{item.createtime}}</div>
				<div class="card_content">
					<img :src="item.image" alt="">
					<div class="card_content_des pt-1">
						<div class="card_content_des_title mb-0">{{$t("关键词")}}</div>
						<div class="card_content_des_content mb-0">{{item.textcountent}}</div>
						<div class="card_content_des_titleC mb-0">
							<div class="des_label">{{$t("风格")}}</div>
							<div class="des_text">{{item.imagestyle}}</div>
						</div>
						<div class="card_content_des_titleC mb-0">
							<div class="des_label">{{$t("分辨率")}}</div>
							<div class="des_text">{{item.imageresolution}}</div>
						</div>
					</div>
				</div>
			</div>
		</div>
  </div>
</template>

<script>
import { getAiDrawList } from "@/request/homePage"
export default {
	name: "AiDrawingHistory",
	data(){
		return{
			aiDrawList: [],

		}
	},
	mounted(){
		this.getListInfo()
	},
	methods:{
		getListInfo(){
			getAiDrawList().then(res=>{
				if(res.code == 1){
					res.data.forEach(item=>{
						if(item.image){
							this.aiDrawList.push({
								...item,
								imagestyle: this.$t(item.imagestyle),
								createtime: new Date(item.createtime*1000).toLocaleString()
							})
						}
					})
				}
			})
		},
		goImageDetail(item){
			if(this.$route.name != "AiCreationDetail"){
				this.$router.push({
					name: "AiCreationDetail",
					params: {
						id: item.id
					}
				})
			}
		},
		onClickLeft(){
			this.$router.go(-1)
		},
	}
}
</script>

<style>

</style>